module.exports = {
  apps: [
    {
      name: 'video-conference-api',
      cwd: './packages/server',
      script: 'dist/index.js',
      instances: 1,
      exec_mode: 'fork',
      env: {
        NODE_ENV: 'production'
      },
      error_file: './logs/api-error.log',
      out_file: './logs/api-out.log',
      log_date_format: 'YYYY-MM-DD HH:mm:ss',
      max_memory_restart: '1G',
      // 自动重启
      autorestart: true,
      // 崩溃后重启前等待时间
      restart_delay: 4000,
      // 最多连续失败重启次数
      max_restarts: 10,
      // 监控变化自动重启 (开发环境)
      // watch: false,
    },
    {
      name: 'video-conference-web',
      cwd: './packages/web',
      script: 'node_modules/vite/bin/vite.js',
      args: 'preview --port 3100 --host 0.0.0.0',
      instances: 1,
      exec_mode: 'fork',
      env: {
        NODE_ENV: 'production'
      },
      error_file: './logs/web-error.log',
      out_file: './logs/web-out.log',
      log_date_format: 'YYYY-MM-DD HH:mm:ss',
      max_memory_restart: '500M',
      autorestart: true,
      restart_delay: 4000,
      max_restarts: 10
    }
  ]
};

